Aluna: Danielly Santos Severino (danyss@ufmg.br)
Orientador: Dani Gamerman (danig@ufmg.br)
Co-Orientadora: Izabel Nolau (nolau@dme.ufrj.br)
2023-05-21
\(T\): Tempo atual
\(t\): Índice do tempo, variando em \(\{1,2, ..., T+H\}\)
\(D\): Atraso máximo relevante
\(d\): Índice do atraso, variando em \(\{0, 1, ..., D\}\)
\(n_{t,d}\): Número de eventos ocorridos no tempo \(t\) registrados após \(d\) unidades de tempo
\(N_{t} = \sum_{d=0}^{D} n_{t,d}\): Número total de eventos ocorridos no tempo \(t\)
Por definição,
\[N_{t} = \sum_{d = 0}^{D} n_{t,d}\]
E, consequentemente,
\[n_{t,d} = N_{t} - \sum_{d = 1}^{D} n_{t,d}\] para \(t = 1, ..., T\) e \(d = 0,1,...,D\).
Ou seja, a partir dos dados para \(d = 1,...,D\) podemos obter os valores de \(n_{t,d=0}\). Dessa forma, não é possível ajustar um modelo para todos os atrasos.
Por isso, vamos ajustar o modelo para \(n_{t,d}\) de \(d = 1,...,D\) e \(N_{t}\) com \(t = 1, ..., T+H\).
No modelo com estrutura de atraso independente cada atraso distinto de notificação foi ajustado conforme as especificações abaixo.
Modelo proposto para os dados:
\[\begin{align} & n_{t,d} \sim Poisson(\lambda_{t,d}) \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; N_{t} \sim Poisson(\theta_{t}) \\ \\ & log(\lambda_{t,d}) = \alpha_{t,d} \\ \\ & exp(\alpha_{t,d}) = \dfrac{a_{d} \; c_{d}\; f_{d}\; \exp(-c_{d}\;t)} {[b_{d} + \exp(-c_{d}\;t)]^ { f_{d} + 1} } \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; exp(\theta_{t}) = \dfrac{a \;c \;f \exp(-c\;t)}{[b + \exp(-c\;t)]^ { f + 1} } \\ \end{align}\]
Para \(t = 1, ..., T+H\) e \(d = 1,...,D\).
Distribuições a priori:
\[\begin{align} & a_{d} \sim Gama(0.1, 0.1) \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; a \sim Gama(0.1, 0.1) \\ & b_{d} \sim Normal(0, \sqrt{20}) \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; b \sim Normal(0, \sqrt{20}) \\ & c_{d} \sim Gama(2, 9) \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; c \sim Gama(2, 9) \\ & f_{d} \sim Gama(0.01, 0.01) \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; f \sim Gama(0.01, 0.01) \\ \end{align}\]
| t | d0 | d1 | d2 | d3 | d4 | d5 | d6 | d7 | d8 | d9 | d10 | N |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 0 (31) | 2 (10) | 1 (8) | 0 (7) | 2 (5) | 0 (3) | 1 (0) | 1 (0) | 0 (0) | 0 (0) | 0 (2) | 7 (55) |
| 2 | 77 (49) | 24 (14) | 11 (11) | 2 (10) | 19 (7) | 8 (4) | 7 (1) | 5 (0) | 2 (0) | 1 (0) | 3 (3) | 159 (81) |
| 3 | 109 (77) | 13 (21) | 11 (16) | 31 (14) | 13 (10) | 2 (6) | 3 (1) | 2 (1) | 0 (0) | 2 (0) | 0 (4) | 186 (119) |
| 4 | 89 (118) | 23 (30) | 31 (22) | 24 (19) | 10 (13) | 8 (8) | 4 (2) | 1 (1) | 0 (0) | 1 (1) | 1 (6) | 192 (175) |
| 5 | 154 (179) | 84 (43) | 68 (31) | 30 (25) | 14 (17) | 4 (11) | 1 (3) | 4 (2) | 7 (1) | 5 (1) | 3 (7) | 374 (257) |
| 6 | 291 (264) | 33 (63) | 56 (44) | 17 (34) | 24 (22) | 22 (14) | 3 (4) | 13 (3) | 5 (1) | 2 (2) | 10 (9) | 476 (374) |
| 7 | 460 (380) | 133 (91) | 68 (61) | 38 (46) | 27 (29) | 29 (19) | 37 (7) | 23 (4) | 6 (2) | 2 (3) | 1 (11) | 824 (541) |
| 8 | 693 (530) | 189 (130) | 89 (84) | 157 (61) | 48 (38) | 71 (25) | 40 (11) | 13 (8) | 9 (4) | 9 (5) | 8 (12) | 1326 (776) |
| 9 | 779 (712) | 187 (184) | 189 (116) | 107 (80) | 91 (48) | 48 (33) | 17 (18) | 12 (13) | 14 (8) | 8 (9) | 9 (12) | 1461 (1098) |
| 10 | 577 (917) | 371 (259) | 179 (157) | 115 (104) | 67 (61) | 35 (42) | 16 (29) | 22 (21) | 5 (15) | 8 (16) | 4 (12) | 1399 (1524) |
| 11 | 533 (1130) | 242 (358) | 168 (209) | 58 (131) | 20 (74) | 26 (53) | 8 (44) | 4 (34) | 12 (26) | 6 (26) | 0 (12) | 1077 (2059) |
| 12 | 1137 (1326) | 325 (483) | 268 (271) | 118 (162) | 60 (89) | 9 (67) | 14 (64) | 9 (54) | 9 (44) | 3 (42) | 2 (11) | 1954 (2683) |
| 13 | 1716 (1481) | 607 (633) | 234 (341) | 147 (194) | 64 (103) | 42 (82) | 26 (90) | 20 (81) | 24 (67) | 26 (64) | 1 (10) | 2907 (3336) |
| 14 | 2240 (1576) | 798 (797) | 375 (412) | 194 (223) | 85 (115) | 78 (97) | 67 (118) | 63 (111) | 83 (89) | 52 (91) | 6 (9) | 4041 (3914) |
| 15 | 2410 (1599) | 950 (954) | 324 (474) | 222 (246) | 97 (123) | 85 (111) | 227 (141) | 205 (137) | 198 (100) | 249 (117) | 6 (7) | 4973 (4290) |
| 16 | 1629 (1553) | 989 (1077) | 435 (517) | 197 (259) | 243 (127) | 180 (124) | 268 (152) | 302 (149) | 116 (93) | 34 (134) | 11 (6) | 4404 (4365) |
| 17 | 501 (1450) | 1369 (1137) | 594 (531) | 332 (259) | 131 (125) | 170 (132) | 144 (145) | 122 (139) | 19 (72) | 29 (135) | 28 (5) | 3439 (4118) |
| 18 | 1032 (1307) | 1082 (1119) | 664 (513) | 370 (247) | 134 (119) | 239 (134) | 140 (124) | 31 (114) | 31 (49) | 44 (119) | 3 (4) | 3770 (3617) |
| 19 | 1079 (1144) | 1093 (1028) | 691 (468) | 262 (225) | 132 (108) | 85 (132) | 17 (97) | 4 (84) | 103 (30) | 79 (95) | 16 (3) | 3561 (2984) |
| 20 | 878 (977) | 778 (887) | 397 (404) | 243 (196) | 94 (95) | 64 (123) | 6 (70) | 104 (57) | 121 (18) | 36 (69) | 5 (3) | 2726 (2336) |
| 21 | 859 (817) | 807 (724) | 381 (333) | 142 (164) | 25 (81) | 8 (111) | 129 (48) | 71 (37) | 11 (10) | 2 (47) | 3 (2) | 2438 (1756) |
| 22 | 853 (671) | 537 (565) | 195 (264) | 29 (134) | 26 (67) | 59 (97) | 73 (32) | 45 (23) | 10 (5) | 9 (31) | 2 (2) | 1838 (1280) |
| 23 | 672 (544) | 536 (426) | 56 (203) | 22 (106) | 64 (54) | 151 (82) | 33 (21) | 10 (14) | 8 (3) | 22 (20) | 5 (1) | 1579 (912) |
| 24 | 513 (436) | 171 (313) | 37 (153) | 100 (83) | 55 (43) | 21 (67) | 19 (13) | 1 (8) | 1 (2) | 1 (12) | 1 (1) | 920 (640) |
| 25 | 273 (347) | 77 (225) | 163 (113) | 156 (63) | 22 (34) | 9 (54) | 4 (8) | 2 (5) | 2 (1) | 4 (8) | 6 (1) | 718 (444) |
| 26 | 124 (274) | 172 (160) | 92 (82) | 31 (48) | 17 (26) | 2 (43) | 2 (5) | 31 (3) | 3 (0) | 4 (5) | 4 (1) | 482 (305) |
| 27 | 142 (215) | 77 (112) | 95 (59) | 53 (36) | 4 (20) | 27 (33) | 35 (3) | 17 (2) | 3 (0) | 1 (3) | 0 (1) | 454 (209) |
| 28 | 73 (168) | 56 (78) | 60 (42) | 19 (27) | 19 (15) | 27 (26) | 1 (2) | 1 (1) | 0 (0) | 2 (2) | 1 (0) | 259 (143) |
| 29 | 72 (131) | 58 (54) | 33 (30) | 3 (20) | 8 (12) | 5 (20) | 1 (1) | 1 (1) | 1 (0) | 1 (1) | 0 (0) | 183 (97) |
| 30 | 70 (102) | 39 (38) | 22 (22) | 10 (15) | 1 (9) | 6 (15) | 5 (1) | 2 (0) | 3 (0) | 0 (1) | 0 (0) | 158 (66) |
| 31 | 70 (79) | 60 (26) | 44 (15) | 1 (11) | 5 (7) | 3 (11) | 2 (0) | 1 (0) | 0 (0) | 3 (0) | 0 (0) | 189 (45) |
| 32 | 32 (61) | 47 (18) | 3 (11) | 3 (8) | 27 (5) | 0 (9) | 1 (0) | 1 (0) | 5 (0) | 1 (0) | 1 (0) | 121 (30) |
| 33 | 39 (48) | 29 (12) | 4 (8) | 21 (6) | 3 (4) | 5 (7) | 2 (0) | 12 (0) | 1 (0) | 0 (0) | 0 (0) | 116 (20) |
| 34 | 41 (37) | 25 (9) | 31 (5) | 12 (4) | 5 (3) | 2 (5) | 7 (0) | 0 (0) | 1 (0) | 2 (0) | 0 (0) | 126 (14) |
| 35 | 30 (28) | 41 (6) | 11 (4) | 10 (3) | 6 (2) | 8 (4) | 3 (0) | 3 (0) | 0 (0) | 0 (0) | 0 (0) | 112 (9) |
Modelo proposto para os dados:
\[n_{t,d} \sim Poisson(\lambda_{t,d}) \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; N_{t} \sim Poisson(\theta_{t})\]
\[log(\lambda_{t,d}) = \alpha_{t} + \beta_{d} \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; \]
\[exp(\alpha_{t}) = \dfrac{a_{\alpha}\; c_{\alpha}\; f_{\alpha} \exp(-c_{\alpha}\;t)} {[b_{\alpha} + \exp(-c_{\alpha}\;t)]^ { f_{\alpha} + 1} } \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; \theta_{t} = \dfrac{a_{\theta}\; c_{\theta}\; f_{\theta} \exp(-c_{\theta}\;t)} {[b_{\theta} + \exp(-c_{\theta}\;t)]^ { f_{\theta} + 1} }\]
\[t = 1, ..., T+H \;\;e\;\; d = 1, ..., D \;\;\;\;\;\;\;\;\;\;\;\;\;\;\; t = 1, ..., T+H\]
\[\beta_{d} = \gamma d \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; \]
Distribuições a priori:
\[a_{\alpha} \sim Gama(0.1, 0.1) \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; a_{\theta} \sim Gama(0.1, 0.1) \]
\[Exp(b_{\alpha}) \sim Normal(0,\sqrt{20}) \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; Exp(b_{\theta}) \sim Normal(0,\sqrt{20})\]
\[c_{\alpha} \sim Gama(2, 9) \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; c_{\theta} \sim Gama(2, 9) \]
\[f_{\alpha} \sim Gama(0.01, 0.01) \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; f_{\theta} \sim Gama(0.01, 0.01) \]
\[\gamma \sim Normal(0,100) \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; \]
Destaca-se que:
\[\theta_{t} > \sum_{d = 1}^{D} \lambda_{t,d}\]
| t | d1 | d2 | d3 | d4 | d5 | d6 | d7 | d8 | d9 | d10 | N |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 2 (18) | 1 (12) | 0 (8) | 2 (5) | 0 (3) | 1 (2) | 1 (1) | 0 (1) | 0 (1) | 0 (0) | 7 (92) |
| 2 | 24 (25) | 11 (16) | 2 (10) | 19 (7) | 8 (4) | 7 (3) | 5 (2) | 2 (1) | 1 (1) | 3 (1) | 159 (127) |
| 3 | 13 (33) | 11 (21) | 31 (14) | 13 (9) | 2 (6) | 3 (4) | 2 (2) | 0 (2) | 2 (1) | 0 (1) | 186 (176) |
| 4 | 23 (44) | 31 (28) | 24 (18) | 10 (12) | 8 (8) | 4 (5) | 1 (3) | 0 (2) | 1 (1) | 1 (1) | 192 (244) |
| 5 | 84 (58) | 68 (38) | 30 (24) | 14 (16) | 4 (10) | 1 (7) | 4 (4) | 7 (3) | 5 (2) | 3 (1) | 374 (337) |
| 6 | 33 (77) | 56 (50) | 17 (33) | 24 (21) | 22 (14) | 3 (9) | 13 (6) | 5 (4) | 2 (2) | 10 (2) | 476 (464) |
| 7 | 133 (103) | 68 (67) | 38 (43) | 27 (28) | 29 (18) | 37 (12) | 23 (8) | 6 (5) | 2 (3) | 1 (2) | 824 (634) |
| 8 | 189 (136) | 89 (88) | 157 (57) | 48 (37) | 71 (24) | 40 (16) | 13 (10) | 9 (7) | 9 (4) | 8 (3) | 1326 (861) |
| 9 | 187 (180) | 189 (117) | 107 (76) | 91 (49) | 48 (32) | 17 (21) | 12 (14) | 14 (9) | 8 (6) | 9 (4) | 1461 (1157) |
| 10 | 371 (239) | 179 (155) | 115 (101) | 67 (65) | 35 (42) | 16 (28) | 22 (18) | 5 (12) | 8 (8) | 4 (5) | 1399 (1532) |
| 11 | 242 (314) | 168 (204) | 58 (132) | 20 (86) | 26 (56) | 8 (36) | 4 (24) | 12 (15) | 6 (10) | 0 (6) | 1077 (1989) |
| 12 | 325 (409) | 268 (266) | 118 (173) | 60 (112) | 9 (73) | 14 (47) | 9 (31) | 9 (20) | 3 (13) | 2 (8) | 1954 (2517) |
| 13 | 607 (527) | 234 (342) | 147 (222) | 64 (144) | 42 (94) | 26 (61) | 20 (40) | 24 (26) | 26 (17) | 1 (11) | 2907 (3079) |
| 14 | 798 (664) | 375 (431) | 194 (280) | 85 (182) | 78 (118) | 67 (77) | 63 (50) | 83 (32) | 52 (21) | 6 (14) | 4041 (3610) |
| 15 | 950 (809) | 324 (525) | 222 (341) | 97 (222) | 85 (144) | 227 (94) | 205 (61) | 198 (40) | 249 (26) | 6 (17) | 4973 (4025) |
| 16 | 989 (938) | 435 (609) | 197 (396) | 243 (257) | 180 (167) | 268 (109) | 302 (71) | 116 (46) | 34 (30) | 11 (19) | 4404 (4238) |
| 17 | 1369 (1014) | 594 (659) | 332 (428) | 131 (278) | 170 (181) | 144 (117) | 122 (76) | 19 (50) | 29 (32) | 28 (21) | 3439 (4197) |
| 18 | 1082 (1004) | 664 (652) | 370 (424) | 134 (275) | 239 (179) | 140 (116) | 31 (75) | 31 (49) | 44 (32) | 3 (21) | 3770 (3907) |
| 19 | 1093 (897) | 691 (583) | 262 (379) | 132 (246) | 85 (160) | 17 (104) | 4 (67) | 103 (44) | 79 (28) | 16 (19) | 3561 (3433) |
| 20 | 778 (725) | 397 (471) | 243 (306) | 94 (199) | 64 (129) | 6 (84) | 104 (54) | 121 (35) | 36 (23) | 5 (15) | 2726 (2864) |
| 21 | 807 (535) | 381 (347) | 142 (226) | 25 (147) | 8 (95) | 129 (62) | 71 (40) | 11 (26) | 2 (17) | 3 (11) | 2438 (2288) |
| 22 | 537 (367) | 195 (239) | 29 (155) | 26 (101) | 59 (65) | 73 (43) | 45 (28) | 10 (18) | 9 (12) | 2 (8) | 1838 (1764) |
| 23 | 536 (240) | 56 (156) | 22 (101) | 64 (66) | 151 (43) | 33 (28) | 10 (18) | 8 (12) | 22 (8) | 5 (5) | 1579 (1324) |
| 24 | 171 (151) | 37 (98) | 100 (64) | 55 (41) | 21 (27) | 19 (17) | 1 (11) | 1 (7) | 1 (5) | 1 (3) | 920 (974) |
| 25 | 77 (93) | 163 (61) | 156 (39) | 22 (26) | 9 (17) | 4 (11) | 2 (7) | 2 (5) | 4 (3) | 6 (2) | 718 (705) |
| 26 | 172 (57) | 92 (37) | 31 (24) | 17 (16) | 2 (10) | 2 (7) | 31 (4) | 3 (3) | 4 (2) | 4 (1) | 482 (505) |
| 27 | 77 (34) | 95 (22) | 53 (14) | 4 (9) | 27 (6) | 35 (4) | 17 (3) | 3 (2) | 1 (1) | 0 (1) | 454 (359) |
| 28 | 56 (20) | 60 (13) | 19 (9) | 19 (6) | 27 (4) | 1 (2) | 1 (2) | 0 (1) | 2 (1) | 1 (0) | 259 (254) |
| 29 | 58 (12) | 33 (8) | 3 (5) | 8 (3) | 5 (2) | 1 (1) | 1 (1) | 1 (1) | 1 (0) | 0 (0) | 183 (179) |
| 30 | 39 (7) | 22 (5) | 10 (3) | 1 (2) | 6 (1) | 5 (1) | 2 (1) | 3 (0) | 0 (0) | 0 (0) | 158 (126) |
| 31 | 60 (4) | 44 (3) | 1 (2) | 5 (1) | 3 (1) | 2 (1) | 1 (0) | 0 (0) | 3 (0) | 0 (0) | 189 (88) |
| 32 | 47 (3) | 3 (2) | 3 (1) | 27 (1) | 0 (0) | 1 (0) | 1 (0) | 5 (0) | 1 (0) | 1 (0) | 121 (62) |
| 33 | 29 (2) | 4 (1) | 21 (1) | 3 (0) | 5 (0) | 2 (0) | 12 (0) | 1 (0) | 0 (0) | 0 (0) | 116 (43) |
| 34 | 25 (1) | 31 (1) | 12 (0) | 5 (0) | 2 (0) | 7 (0) | 0 (0) | 1 (0) | 2 (0) | 0 (0) | 126 (30) |
| 35 | 41 (1) | 11 (0) | 10 (0) | 6 (0) | 8 (0) | 3 (0) | 3 (0) | 0 (0) | 0 (0) | 0 (0) | 112 (21) |
De acordo com o modelo ajustado devemos avaliar o erro de estimação pata \(t = 1,..., T\) e o erro de previsão para \(t = T, ..., T+H\). Uma forma de contabilizar esses erros é através das métricas MAE e RMSE.
Mean Absolute Error Estimation (MAE):
\[\frac{\sum_{t = 1}^{T} |\hat{\theta_{t}} - \theta_{t}|}{T} \]
Root Mean Squared Error Estimation (RMSE):
\[\sqrt{ \frac{\sum_{t = 1}^{T} (\hat{\theta_{t}} - \theta_{t})^2}{T} }\]
Mean Absolute Error Prevision (MAE):
\[\frac{\sum_{t = T}^{T+H} |\hat{y_{t}} - y_{t}|}{H} \]
Root Mean Squared Error Prevision (RMSE):
\[\sqrt{ \frac{\sum_{t = T}^{T+H} (\hat{y_{t}} - y_{t})^2}{H} }\]
O MAE e RMSE medem a magnitude média dos erros em um conjunto de previsões.
O RMSE dá um peso maior para erros grandes. Além disso, o RMSE sempre será maior ou igual ao MAE e quanto maior a diferença entre eles, maior a variância dos erros individuais nos dados. Se MAE = RMSE, então todos os erros são da mesma magnitude.